<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>yadis.test.test_etxrd</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="yadis-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.openidenabled.com/yadis/">Python-Yadis</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="yadis-module.html">Package&nbsp;yadis</a> ::
        <a href="yadis.test-module.html">Package&nbsp;test</a> ::
        Module&nbsp;test_etxrd
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="yadis.test.test_etxrd-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="yadis.test.test_etxrd-module.html">Module yadis.test.test_etxrd</a></h1>
<pre class="py-src">
<tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">unittest</tt> </tt>
<tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package yadis=yadis-module.html"><a title="yadis" class="py-name" href="#" onclick="return doclink('link-0', 'yadis', 'link-0');">yadis</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Module yadis.services=yadis.services-module.html"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-1', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">,</tt> <tt id="link-2" class="py-name" targets="Module yadis.etxrd=yadis.etxrd-module.html"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-2', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name" targets="Module yadis.xri=yadis.xri-module.html"><a title="yadis.xri" class="py-name" href="#" onclick="return doclink('link-3', 'xri', 'link-3');">xri</a></tt></tt> </tt>
<tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt> </tt>
<tt class="py-lineno">  4</tt>  <tt class="py-line"> </tt>
<a name="sibpath"></a><div id="sibpath-def"><tt class="py-lineno">  5</tt> <a class="py-toggle" href="#" id="sibpath-toggle" onclick="return toggle('sibpath');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd-module.html#sibpath">sibpath</a><tt class="py-op">(</tt><tt class="py-param">one</tt><tt class="py-op">,</tt> <tt class="py-param">other</tt><tt class="py-op">,</tt> <tt class="py-param">make_absolute</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="sibpath-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="sibpath-expanded"><tt class="py-lineno">  6</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">isabs</tt><tt class="py-op">(</tt><tt class="py-name">other</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">  7</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">other</tt> </tt>
<tt class="py-lineno">  8</tt>  <tt class="py-line">    <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">one</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">other</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">  9</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">make_absolute</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 10</tt>  <tt class="py-line">        <tt class="py-name">p</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">abspath</tt><tt class="py-op">(</tt><tt class="py-name">p</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 11</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">p</tt> </tt>
</div><tt class="py-lineno"> 12</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable yadis.test.test_etxrd.XRD_FILE=yadis.test.test_etxrd-module.html#XRD_FILE"><a title="yadis.test.test_etxrd.XRD_FILE" class="py-name" href="#" onclick="return doclink('link-4', 'XRD_FILE', 'link-4');">XRD_FILE</a></tt></tt> <tt class="py-op">=</tt> <tt id="link-5" class="py-name" targets="Function yadis.test.test_etxrd.sibpath()=yadis.test.test_etxrd-module.html#sibpath"><a title="yadis.test.test_etxrd.sibpath" class="py-name" href="#" onclick="return doclink('link-5', 'sibpath', 'link-5');">sibpath</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">"data"</tt><tt class="py-op">,</tt> <tt class="py-string">"test1-xrd.xml"</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable yadis.test.test_etxrd.NOXRDS_FILE=yadis.test.test_etxrd-module.html#NOXRDS_FILE"><a title="yadis.test.test_etxrd.NOXRDS_FILE" class="py-name" href="#" onclick="return doclink('link-6', 'NOXRDS_FILE', 'link-6');">NOXRDS_FILE</a></tt></tt> <tt class="py-op">=</tt> <tt id="link-7" class="py-name"><a title="yadis.test.test_etxrd.sibpath" class="py-name" href="#" onclick="return doclink('link-7', 'sibpath', 'link-5');">sibpath</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">"data"</tt><tt class="py-op">,</tt> <tt class="py-string">"not-xrds.xml"</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable yadis.test.test_etxrd.NOXRD_FILE=yadis.test.test_etxrd-module.html#NOXRD_FILE"><a title="yadis.test.test_etxrd.NOXRD_FILE" class="py-name" href="#" onclick="return doclink('link-8', 'NOXRD_FILE', 'link-8');">NOXRD_FILE</a></tt></tt> <tt class="py-op">=</tt> <tt id="link-9" class="py-name"><a title="yadis.test.test_etxrd.sibpath" class="py-name" href="#" onclick="return doclink('link-9', 'sibpath', 'link-5');">sibpath</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">"data"</tt><tt class="py-op">,</tt> <tt class="py-string">"no-xrd.xml"</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 17</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-comment"># None of the namespaces or service URIs below are official (or even</tt> </tt>
<tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment"># sanctioned by the owners of that piece of URL-space)</tt> </tt>
<tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt id="link-10" class="py-name" targets="Variable yadis.test.test_etxrd.LID_2_0=yadis.test.test_etxrd-module.html#LID_2_0"><a title="yadis.test.test_etxrd.LID_2_0" class="py-name" href="#" onclick="return doclink('link-10', 'LID_2_0', 'link-10');">LID_2_0</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://lid.netmesh.org/sso/2.0b5"</tt> </tt>
<tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt id="link-11" class="py-name" targets="Variable yadis.test.test_etxrd.TYPEKEY_1_0=yadis.test.test_etxrd-module.html#TYPEKEY_1_0"><a title="yadis.test.test_etxrd.TYPEKEY_1_0" class="py-name" href="#" onclick="return doclink('link-11', 'TYPEKEY_1_0', 'link-11');">TYPEKEY_1_0</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://typekey.com/services/1.0"</tt> </tt>
<tt class="py-lineno"> 23</tt>  <tt class="py-line"> </tt>
<a name="simpleOpenIDTransformer"></a><div id="simpleOpenIDTransformer-def"><tt class="py-lineno"> 24</tt> <a class="py-toggle" href="#" id="simpleOpenIDTransformer-toggle" onclick="return toggle('simpleOpenIDTransformer');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd-module.html#simpleOpenIDTransformer">simpleOpenIDTransformer</a><tt class="py-op">(</tt><tt class="py-param">endpoint</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="simpleOpenIDTransformer-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="simpleOpenIDTransformer-expanded"><tt class="py-lineno"> 25</tt>  <tt class="py-line">    <tt class="py-docstring">"""Function to extract information from an OpenID service element"""</tt> </tt>
<tt class="py-lineno"> 26</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-string">'http://openid.net/signon/1.0'</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-name">endpoint</tt><tt class="py-op">.</tt><tt class="py-name">type_uris</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">None</tt> </tt>
<tt class="py-lineno"> 28</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 29</tt>  <tt class="py-line">    <tt class="py-name">delegates</tt> <tt class="py-op">=</tt> <tt class="py-name">list</tt><tt class="py-op">(</tt><tt class="py-name">endpoint</tt><tt class="py-op">.</tt><tt class="py-name">service_element</tt><tt class="py-op">.</tt><tt class="py-name">findall</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno"> 30</tt>  <tt class="py-line">        <tt class="py-string">'{http://openid.net/xmlns/1.0}Delegate'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 31</tt>  <tt class="py-line">    <tt class="py-keyword">assert</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">delegates</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt> </tt>
<tt class="py-lineno"> 32</tt>  <tt class="py-line">    <tt class="py-name">delegate</tt> <tt class="py-op">=</tt> <tt class="py-name">delegates</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">text</tt> </tt>
<tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">endpoint</tt><tt class="py-op">.</tt><tt class="py-name">uri</tt><tt class="py-op">,</tt> <tt class="py-name">delegate</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 34</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser"></a><div id="TestServiceParser-def"><tt class="py-lineno"> 35</tt> <a class="py-toggle" href="#" id="TestServiceParser-toggle" onclick="return toggle('TestServiceParser');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html">TestServiceParser</a><tt class="py-op">(</tt><tt class="py-base-class">unittest</tt><tt class="py-op">.</tt><tt class="py-base-class">TestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TestServiceParser-expanded"><a name="TestServiceParser.setUp"></a><div id="TestServiceParser.setUp-def"><tt class="py-lineno"> 36</tt> <a class="py-toggle" href="#" id="TestServiceParser.setUp-toggle" onclick="return toggle('TestServiceParser.setUp');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#setUp">setUp</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.setUp-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.setUp-expanded"><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt> <tt class="py-op">=</tt> <tt class="py-name">file</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name"><a title="yadis.test.test_etxrd.XRD_FILE" class="py-name" href="#" onclick="return doclink('link-12', 'XRD_FILE', 'link-4');">XRD_FILE</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">yadis_url</tt> <tt class="py-op">=</tt> <tt class="py-string">'http://unittest.url/'</tt> </tt>
</div><tt class="py-lineno"> 39</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser._getServices"></a><div id="TestServiceParser._getServices-def"><tt class="py-lineno"> 40</tt> <a class="py-toggle" href="#" id="TestServiceParser._getServices-toggle" onclick="return toggle('TestServiceParser._getServices');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#_getServices">_getServices</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">flt</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser._getServices-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser._getServices-expanded"><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">list</tt><tt class="py-op">(</tt><tt id="link-13" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-13', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">.</tt><tt id="link-14" class="py-name" targets="Function yadis.services.applyFilter()=yadis.services-module.html#applyFilter"><a title="yadis.services.applyFilter" class="py-name" href="#" onclick="return doclink('link-14', 'applyFilter', 'link-14');">applyFilter</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">yadis_url</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt><tt class="py-op">,</tt> <tt class="py-name">flt</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 42</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testParse"></a><div id="TestServiceParser.testParse-def"><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="TestServiceParser.testParse-toggle" onclick="return toggle('TestServiceParser.testParse');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testParse">testParse</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testParse-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testParse-expanded"><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-docstring">"""Make sure that parsing succeeds at all"""</tt> </tt>
<tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt id="link-15" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-15', 'services', 'link-1');">services</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Method yadis.test.test_etxrd.TestServiceParser._getServices()=yadis.test.test_etxrd.TestServiceParser-class.html#_getServices"><a title="yadis.test.test_etxrd.TestServiceParser._getServices" class="py-name" href="#" onclick="return doclink('link-16', '_getServices', 'link-16');">_getServices</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 46</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testParseOpenID"></a><div id="TestServiceParser.testParseOpenID-def"><tt class="py-lineno"> 47</tt> <a class="py-toggle" href="#" id="TestServiceParser.testParseOpenID-toggle" onclick="return toggle('TestServiceParser.testParseOpenID');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testParseOpenID">testParseOpenID</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testParseOpenID-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testParseOpenID-expanded"><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-docstring">"""Parse for OpenID services with a transformer function"""</tt> </tt>
<tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt id="link-17" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-17', 'services', 'link-1');">services</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="yadis.test.test_etxrd.TestServiceParser._getServices" class="py-name" href="#" onclick="return doclink('link-18', '_getServices', 'link-16');">_getServices</a></tt></tt><tt class="py-op">(</tt><tt id="link-19" class="py-name" targets="Function yadis.test.test_etxrd.simpleOpenIDTransformer()=yadis.test.test_etxrd-module.html#simpleOpenIDTransformer"><a title="yadis.test.test_etxrd.simpleOpenIDTransformer" class="py-name" href="#" onclick="return doclink('link-19', 'simpleOpenIDTransformer', 'link-19');">simpleOpenIDTransformer</a></tt></tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 50</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-name">expectedServices</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> </tt>
<tt class="py-lineno"> 52</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"http://www.myopenid.com/server"</tt><tt class="py-op">,</tt> <tt class="py-string">"http://josh.myopenid.com/"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 53</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"http://www.schtuff.com/openid"</tt><tt class="py-op">,</tt> <tt class="py-string">"http://users.schtuff.com/josh"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 54</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt class="py-string">"http://www.livejournal.com/openid/server.bml"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 55</tt>  <tt class="py-line">             <tt class="py-string">"http://www.livejournal.com/users/nedthealpaca/"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 56</tt>  <tt class="py-line">            <tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 57</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 58</tt>  <tt class="py-line">        <tt class="py-name">it</tt> <tt class="py-op">=</tt> <tt class="py-name">iter</tt><tt class="py-op">(</tt><tt id="link-20" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-20', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-op">(</tt><tt class="py-name">server_url</tt><tt class="py-op">,</tt> <tt class="py-name">delegate</tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt class="py-name">expectedServices</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 60</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-op">(</tt><tt class="py-name">actual_url</tt><tt class="py-op">,</tt> <tt class="py-name">actual_delegate</tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt class="py-name">it</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 61</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessEqual</tt><tt class="py-op">(</tt><tt class="py-name">server_url</tt><tt class="py-op">,</tt> <tt class="py-name">actual_url</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 62</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessEqual</tt><tt class="py-op">(</tt><tt class="py-name">delegate</tt><tt class="py-op">,</tt> <tt class="py-name">actual_delegate</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 63</tt>  <tt class="py-line">                <tt class="py-keyword">break</tt> </tt>
<tt class="py-lineno"> 64</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 65</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fail</tt><tt class="py-op">(</tt><tt class="py-string">'Not enough services found'</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 66</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser._checkServices"></a><div id="TestServiceParser._checkServices-def"><tt class="py-lineno"> 67</tt> <a class="py-toggle" href="#" id="TestServiceParser._checkServices-toggle" onclick="return toggle('TestServiceParser._checkServices');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#_checkServices">_checkServices</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">expectedServices</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser._checkServices-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser._checkServices-expanded"><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-docstring">"""Check to make sure that the expected services are found in</tt> </tt>
<tt class="py-lineno"> 69</tt>  <tt class="py-line"><tt class="py-docstring">        that order in the parsed document."""</tt> </tt>
<tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-name">it</tt> <tt class="py-op">=</tt> <tt class="py-name">iter</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="yadis.test.test_etxrd.TestServiceParser._getServices" class="py-name" href="#" onclick="return doclink('link-21', '_getServices', 'link-16');">_getServices</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-op">(</tt><tt class="py-name">type_uri</tt><tt class="py-op">,</tt> <tt class="py-name">uri</tt><tt class="py-op">)</tt> <tt class="py-keyword">in</tt> <tt class="py-name">expectedServices</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 72</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">service</tt> <tt class="py-keyword">in</tt> <tt class="py-name">it</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 73</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">type_uri</tt> <tt class="py-keyword">in</tt> <tt class="py-name">service</tt><tt class="py-op">.</tt><tt class="py-name">type_uris</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 74</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessEqual</tt><tt class="py-op">(</tt><tt class="py-name">service</tt><tt class="py-op">.</tt><tt class="py-name">uri</tt><tt class="py-op">,</tt> <tt class="py-name">uri</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno"> 75</tt>  <tt class="py-line">                    <tt class="py-keyword">break</tt> </tt>
<tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 77</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fail</tt><tt class="py-op">(</tt><tt class="py-string">'Did not find %r service'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">type_uri</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 78</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testGetSeveral"></a><div id="TestServiceParser.testGetSeveral-def"><tt class="py-lineno"> 79</tt> <a class="py-toggle" href="#" id="TestServiceParser.testGetSeveral-toggle" onclick="return toggle('TestServiceParser.testGetSeveral');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testGetSeveral">testGetSeveral</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testGetSeveral-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testGetSeveral-expanded"><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-docstring">"""Get some services in order"""</tt> </tt>
<tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">expectedServices</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> </tt>
<tt class="py-lineno"> 82</tt>  <tt class="py-line">            <tt class="py-comment"># type, URL</tt> </tt>
<tt class="py-lineno"> 83</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt id="link-22" class="py-name"><a title="yadis.test.test_etxrd.TYPEKEY_1_0" class="py-name" href="#" onclick="return doclink('link-22', 'TYPEKEY_1_0', 'link-11');">TYPEKEY_1_0</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 84</tt>  <tt class="py-line">            <tt class="py-op">(</tt><tt id="link-23" class="py-name"><a title="yadis.test.test_etxrd.LID_2_0" class="py-name" href="#" onclick="return doclink('link-23', 'LID_2_0', 'link-10');">LID_2_0</a></tt></tt><tt class="py-op">,</tt> <tt class="py-string">"http://mylid.net/josh"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno"> 85</tt>  <tt class="py-line">            <tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 86</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method yadis.test.test_etxrd.TestServiceParser._checkServices()=yadis.test.test_etxrd.TestServiceParser-class.html#_checkServices"><a title="yadis.test.test_etxrd.TestServiceParser._checkServices" class="py-name" href="#" onclick="return doclink('link-24', '_checkServices', 'link-24');">_checkServices</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">expectedServices</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno"> 88</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testGetSeveralForOne"></a><div id="TestServiceParser.testGetSeveralForOne-def"><tt class="py-lineno"> 89</tt> <a class="py-toggle" href="#" id="TestServiceParser.testGetSeveralForOne-toggle" onclick="return toggle('TestServiceParser.testGetSeveralForOne');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testGetSeveralForOne">testGetSeveralForOne</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testGetSeveralForOne-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testGetSeveralForOne-expanded"><tt class="py-lineno"> 90</tt>  <tt class="py-line">        <tt class="py-docstring">"""Getting services for one Service with several Type elements."""</tt> </tt>
<tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-name">types</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> <tt class="py-string">'http://lid.netmesh.org/sso/2.0b5'</tt> </tt>
<tt class="py-lineno"> 92</tt>  <tt class="py-line">                <tt class="py-op">,</tt> <tt class="py-string">'http://lid.netmesh.org/2.0b5'</tt> </tt>
<tt class="py-lineno"> 93</tt>  <tt class="py-line">                <tt class="py-op">]</tt> </tt>
<tt class="py-lineno"> 94</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-name">uri</tt> <tt class="py-op">=</tt> <tt class="py-string">"http://mylid.net/josh"</tt> </tt>
<tt class="py-lineno"> 96</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">service</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="yadis.test.test_etxrd.TestServiceParser._getServices" class="py-name" href="#" onclick="return doclink('link-25', '_getServices', 'link-16');">_getServices</a></tt></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">service</tt><tt class="py-op">.</tt><tt class="py-name">uri</tt> <tt class="py-op">==</tt> <tt class="py-name">uri</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno"> 99</tt>  <tt class="py-line">                <tt class="py-name">found_types</tt> <tt class="py-op">=</tt> <tt class="py-name">service</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name" targets="Function yadis.accept.matchTypes()=yadis.accept-module.html#matchTypes,Method yadis.filters.BasicServiceEndpoint.matchTypes()=yadis.filters.BasicServiceEndpoint-class.html#matchTypes"><a title="yadis.accept.matchTypes
yadis.filters.BasicServiceEndpoint.matchTypes" class="py-name" href="#" onclick="return doclink('link-26', 'matchTypes', 'link-26');">matchTypes</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">types</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">100</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">found_types</tt> <tt class="py-op">==</tt> <tt class="py-name">types</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">101</tt>  <tt class="py-line">                    <tt class="py-keyword">break</tt> </tt>
<tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fail</tt><tt class="py-op">(</tt><tt class="py-string">'Did not find service with expected types and uris'</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">104</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testNoXRDS"></a><div id="TestServiceParser.testNoXRDS-def"><tt class="py-lineno">105</tt> <a class="py-toggle" href="#" id="TestServiceParser.testNoXRDS-toggle" onclick="return toggle('TestServiceParser.testNoXRDS');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testNoXRDS">testNoXRDS</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testNoXRDS-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testNoXRDS-expanded"><tt class="py-lineno">106</tt>  <tt class="py-line">        <tt class="py-docstring">"""Make sure that we get an exception when an XRDS element is</tt> </tt>
<tt class="py-lineno">107</tt>  <tt class="py-line"><tt class="py-docstring">        not present"""</tt> </tt>
<tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt> <tt class="py-op">=</tt> <tt class="py-name">file</tt><tt class="py-op">(</tt><tt id="link-27" class="py-name"><a title="yadis.test.test_etxrd.NOXRDS_FILE" class="py-name" href="#" onclick="return doclink('link-27', 'NOXRDS_FILE', 'link-6');">NOXRDS_FILE</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessRaises</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno">110</tt>  <tt class="py-line">            <tt id="link-28" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-28', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Class yadis.etxrd.XRDSError=yadis.etxrd.XRDSError-class.html"><a title="yadis.etxrd.XRDSError" class="py-name" href="#" onclick="return doclink('link-29', 'XRDSError', 'link-29');">XRDSError</a></tt></tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">111</tt>  <tt class="py-line">            <tt id="link-30" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-30', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="yadis.services.applyFilter" class="py-name" href="#" onclick="return doclink('link-31', 'applyFilter', 'link-14');">applyFilter</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">yadis_url</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">112</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testEmpty"></a><div id="TestServiceParser.testEmpty-def"><tt class="py-lineno">113</tt> <a class="py-toggle" href="#" id="TestServiceParser.testEmpty-toggle" onclick="return toggle('TestServiceParser.testEmpty');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testEmpty">testEmpty</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testEmpty-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testEmpty-expanded"><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-docstring">"""Make sure that we get an exception when an XRDS element is</tt> </tt>
<tt class="py-lineno">115</tt>  <tt class="py-line"><tt class="py-docstring">        not present"""</tt> </tt>
<tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessRaises</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno">118</tt>  <tt class="py-line">            <tt id="link-32" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-32', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="yadis.etxrd.XRDSError" class="py-name" href="#" onclick="return doclink('link-33', 'XRDSError', 'link-29');">XRDSError</a></tt></tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">119</tt>  <tt class="py-line">            <tt id="link-34" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-34', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="yadis.services.applyFilter" class="py-name" href="#" onclick="return doclink('link-35', 'applyFilter', 'link-14');">applyFilter</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">yadis_url</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">120</tt>  <tt class="py-line"> </tt>
<a name="TestServiceParser.testNoXRD"></a><div id="TestServiceParser.testNoXRD-def"><tt class="py-lineno">121</tt> <a class="py-toggle" href="#" id="TestServiceParser.testNoXRD-toggle" onclick="return toggle('TestServiceParser.testNoXRD');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestServiceParser-class.html#testNoXRD">testNoXRD</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestServiceParser.testNoXRD-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestServiceParser.testNoXRD-expanded"><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-docstring">"""Make sure that we get an exception when there is no XRD</tt> </tt>
<tt class="py-lineno">123</tt>  <tt class="py-line"><tt class="py-docstring">        element present."""</tt> </tt>
<tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt> <tt class="py-op">=</tt> <tt class="py-name">file</tt><tt class="py-op">(</tt><tt id="link-36" class="py-name"><a title="yadis.test.test_etxrd.NOXRD_FILE" class="py-name" href="#" onclick="return doclink('link-36', 'NOXRD_FILE', 'link-8');">NOXRD_FILE</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessRaises</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno">126</tt>  <tt class="py-line">            <tt id="link-37" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-37', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="yadis.etxrd.XRDSError" class="py-name" href="#" onclick="return doclink('link-38', 'XRDSError', 'link-29');">XRDSError</a></tt></tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">127</tt>  <tt class="py-line">            <tt id="link-39" class="py-name"><a title="yadis.services" class="py-name" href="#" onclick="return doclink('link-39', 'services', 'link-1');">services</a></tt></tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="yadis.services.applyFilter" class="py-name" href="#" onclick="return doclink('link-40', 'applyFilter', 'link-14');">applyFilter</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">yadis_url</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmldoc</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
</div></div><tt class="py-lineno">128</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">129</tt>  <tt class="py-line"> </tt>
<a name="TestCanonicalID"></a><div id="TestCanonicalID-def"><tt class="py-lineno">130</tt> <a class="py-toggle" href="#" id="TestCanonicalID-toggle" onclick="return toggle('TestCanonicalID');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestCanonicalID-class.html">TestCanonicalID</a><tt class="py-op">(</tt><tt class="py-base-class">unittest</tt><tt class="py-op">.</tt><tt class="py-base-class">TestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCanonicalID-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="TestCanonicalID-expanded"><tt class="py-lineno">131</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">132</tt>  <tt class="py-line">    <tt id="link-41" class="py-name" targets="Variable yadis.test.test_etxrd.TestCanonicalID.canonicalIDtests=yadis.test.test_etxrd.TestCanonicalID-class.html#canonicalIDtests"><a title="yadis.test.test_etxrd.TestCanonicalID.canonicalIDtests" class="py-name" href="#" onclick="return doclink('link-41', 'canonicalIDtests', 'link-41');">canonicalIDtests</a></tt></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> </tt>
<tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@ootao*test1"</tt><tt class="py-op">,</tt> <tt class="py-string">"delegated-20060809.xrds"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">134</tt>  <tt class="py-line">         <tt class="py-string">"@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@ootao*test1"</tt><tt class="py-op">,</tt> <tt class="py-string">"delegated-20060809-r1.xrds"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">136</tt>  <tt class="py-line">         <tt class="py-string">"@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">137</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@ootao*test1"</tt><tt class="py-op">,</tt> <tt class="py-string">"delegated-20060809-r2.xrds"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">138</tt>  <tt class="py-line">         <tt class="py-string">"@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">139</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@ootao*test1"</tt><tt class="py-op">,</tt> <tt class="py-string">"sometimesprefix.xrds"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">140</tt>  <tt class="py-line">         <tt class="py-string">"@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">141</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@ootao*test1"</tt><tt class="py-op">,</tt> <tt class="py-string">"prefixsometimes.xrds"</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">142</tt>  <tt class="py-line">         <tt class="py-string">"@!5BAD.2AA.3C72.AF46!0000.0000.3B9A.CA01"</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"=keturn*isDrummond"</tt><tt class="py-op">,</tt> <tt class="py-string">"spoof1.xrds"</tt><tt class="py-op">,</tt> <tt id="link-42" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-42', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Class yadis.etxrd.XRDSFraud=yadis.etxrd.XRDSFraud-class.html"><a title="yadis.etxrd.XRDSFraud" class="py-name" href="#" onclick="return doclink('link-43', 'XRDSFraud', 'link-43');">XRDSFraud</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">144</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"=keturn*isDrummond"</tt><tt class="py-op">,</tt> <tt class="py-string">"spoof2.xrds"</tt><tt class="py-op">,</tt> <tt id="link-44" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-44', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="yadis.etxrd.XRDSFraud" class="py-name" href="#" onclick="return doclink('link-45', 'XRDSFraud', 'link-43');">XRDSFraud</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">145</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"@keturn*is*drummond"</tt><tt class="py-op">,</tt> <tt class="py-string">"spoof3.xrds"</tt><tt class="py-op">,</tt> <tt id="link-46" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-46', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-47" class="py-name"><a title="yadis.etxrd.XRDSFraud" class="py-name" href="#" onclick="return doclink('link-47', 'XRDSFraud', 'link-43');">XRDSFraud</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">146</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"=x"</tt><tt class="py-op">,</tt> <tt class="py-string">"status222.xrds"</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">147</tt>  <tt class="py-line">        <tt class="py-comment"># Don't let IRI authorities be canonical for the GCS.</tt> </tt>
<tt class="py-lineno">148</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">"phreak.example.com"</tt><tt class="py-op">,</tt> <tt class="py-string">"delegated-20060809-r2.xrds"</tt><tt class="py-op">,</tt> <tt id="link-48" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-48', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="yadis.etxrd.XRDSFraud" class="py-name" href="#" onclick="return doclink('link-49', 'XRDSFraud', 'link-43');">XRDSFraud</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">149</tt>  <tt class="py-line">        <tt class="py-comment"># TODO: Refs</tt> </tt>
<tt class="py-lineno">150</tt>  <tt class="py-line">        <tt class="py-comment"># ("@ootao*test.ref", "ref.xrds", "@!BAE.A650.823B.2475")</tt> </tt>
<tt class="py-lineno">151</tt>  <tt class="py-line">        <tt class="py-op">]</tt> </tt>
<tt class="py-lineno">152</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">153</tt>  <tt class="py-line">    <tt class="py-comment"># TODO: Add a IRI authority with an IRI canonicalID.</tt> </tt>
<tt class="py-lineno">154</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-comment"># TODO: Add test cases with real examples of multiple CanonicalIDs</tt> </tt>
<tt class="py-lineno">155</tt>  <tt class="py-line"><tt class="py-comment"></tt>    <tt class="py-comment">#   somewhere in the resolution chain.</tt> </tt>
<tt class="py-lineno">156</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="TestCanonicalID.test_getCanonicalID"></a><div id="TestCanonicalID.test_getCanonicalID-def"><tt class="py-lineno">157</tt> <a class="py-toggle" href="#" id="TestCanonicalID.test_getCanonicalID-toggle" onclick="return toggle('TestCanonicalID.test_getCanonicalID');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestCanonicalID-class.html#test_getCanonicalID">test_getCanonicalID</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCanonicalID.test_getCanonicalID-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCanonicalID.test_getCanonicalID-expanded"><tt class="py-lineno">158</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">iname</tt><tt class="py-op">,</tt> <tt id="link-50" class="py-name" targets="Variable yadis.test.test_parsehtml.filename=yadis.test.test_parsehtml-module.html#filename"><a title="yadis.test.test_parsehtml.filename" class="py-name" href="#" onclick="return doclink('link-50', 'filename', 'link-50');">filename</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">expectedID</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="yadis.test.test_etxrd.TestCanonicalID.canonicalIDtests" class="py-name" href="#" onclick="return doclink('link-51', 'canonicalIDtests', 'link-41');">canonicalIDtests</a></tt></tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">159</tt>  <tt class="py-line">            <tt id="link-52" class="py-name"><a title="yadis.test.test_parsehtml.filename" class="py-name" href="#" onclick="return doclink('link-52', 'filename', 'link-50');">filename</a></tt></tt> <tt class="py-op">=</tt> <tt id="link-53" class="py-name"><a title="yadis.test.test_etxrd.sibpath" class="py-name" href="#" onclick="return doclink('link-53', 'sibpath', 'link-5');">sibpath</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">path</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">"data"</tt><tt class="py-op">,</tt> <tt id="link-54" class="py-name"><a title="yadis.test.test_parsehtml.filename" class="py-name" href="#" onclick="return doclink('link-54', 'filename', 'link-50');">filename</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">160</tt>  <tt class="py-line">            <tt class="py-name">xrds</tt> <tt class="py-op">=</tt> <tt id="link-55" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-55', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Function yadis.etxrd.parseXRDS()=yadis.etxrd-module.html#parseXRDS"><a title="yadis.etxrd.parseXRDS" class="py-name" href="#" onclick="return doclink('link-56', 'parseXRDS', 'link-56');">parseXRDS</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">(</tt><tt id="link-57" class="py-name"><a title="yadis.test.test_parsehtml.filename" class="py-name" href="#" onclick="return doclink('link-57', 'filename', 'link-50');">filename</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">161</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name" targets="Method yadis.test.test_etxrd.TestCanonicalID._getCanonicalID()=yadis.test.test_etxrd.TestCanonicalID-class.html#_getCanonicalID"><a title="yadis.test.test_etxrd.TestCanonicalID._getCanonicalID" class="py-name" href="#" onclick="return doclink('link-58', '_getCanonicalID', 'link-58');">_getCanonicalID</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">iname</tt><tt class="py-op">,</tt> <tt class="py-name">xrds</tt><tt class="py-op">,</tt> <tt class="py-name">expectedID</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">162</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">163</tt>  <tt class="py-line"> </tt>
<a name="TestCanonicalID._getCanonicalID"></a><div id="TestCanonicalID._getCanonicalID-def"><tt class="py-lineno">164</tt> <a class="py-toggle" href="#" id="TestCanonicalID._getCanonicalID-toggle" onclick="return toggle('TestCanonicalID._getCanonicalID');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.test.test_etxrd.TestCanonicalID-class.html#_getCanonicalID">_getCanonicalID</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">iname</tt><tt class="py-op">,</tt> <tt class="py-param">xrds</tt><tt class="py-op">,</tt> <tt class="py-param">expectedID</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="TestCanonicalID._getCanonicalID-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="TestCanonicalID._getCanonicalID-expanded"><tt class="py-lineno">165</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">expectedID</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-name">str</tt><tt class="py-op">,</tt> <tt class="py-name">unicode</tt><tt class="py-op">,</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">166</tt>  <tt class="py-line">            <tt class="py-name">cid</tt> <tt class="py-op">=</tt> <tt id="link-59" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-59', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-60" class="py-name" targets="Function yadis.etxrd.getCanonicalID()=yadis.etxrd-module.html#getCanonicalID"><a title="yadis.etxrd.getCanonicalID" class="py-name" href="#" onclick="return doclink('link-60', 'getCanonicalID', 'link-60');">getCanonicalID</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">iname</tt><tt class="py-op">,</tt> <tt class="py-name">xrds</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">167</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessEqual</tt><tt class="py-op">(</tt><tt class="py-name">cid</tt><tt class="py-op">,</tt> <tt class="py-name">expectedID</tt> <tt class="py-keyword">and</tt> <tt id="link-61" class="py-name"><a title="yadis.xri" class="py-name" href="#" onclick="return doclink('link-61', 'xri', 'link-3');">xri</a></tt></tt><tt class="py-op">.</tt><tt id="link-62" class="py-name" targets="Function yadis.xri.XRI()=yadis.xri-module.html#XRI"><a title="yadis.xri.XRI" class="py-name" href="#" onclick="return doclink('link-62', 'XRI', 'link-62');">XRI</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">expectedID</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">168</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">issubclass</tt><tt class="py-op">(</tt><tt class="py-name">expectedID</tt><tt class="py-op">,</tt> <tt id="link-63" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-63', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="yadis.etxrd.XRDSError" class="py-name" href="#" onclick="return doclink('link-64', 'XRDSError', 'link-29');">XRDSError</a></tt></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">169</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">failUnlessRaises</tt><tt class="py-op">(</tt><tt class="py-name">expectedID</tt><tt class="py-op">,</tt> <tt id="link-65" class="py-name"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-65', 'etxrd', 'link-2');">etxrd</a></tt></tt><tt class="py-op">.</tt><tt id="link-66" class="py-name"><a title="yadis.etxrd.getCanonicalID" class="py-name" href="#" onclick="return doclink('link-66', 'getCanonicalID', 'link-60');">getCanonicalID</a></tt></tt><tt class="py-op">,</tt> </tt>
<tt class="py-lineno">170</tt>  <tt class="py-line">                                  <tt class="py-name">iname</tt><tt class="py-op">,</tt> <tt class="py-name">xrds</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">171</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">172</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fail</tt><tt class="py-op">(</tt><tt class="py-string">"Don't know how to test for expected value %r"</tt> </tt>
<tt class="py-lineno">173</tt>  <tt class="py-line">                      <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">expectedID</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div></div><tt class="py-lineno">174</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">175</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">176</tt>  <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">177</tt>  <tt class="py-line">    <tt class="py-name">unittest</tt><tt class="py-op">.</tt><tt class="py-name">main</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">178</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="yadis-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.openidenabled.com/yadis/">Python-Yadis</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Fri Dec  8 13:17:19 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
